<?
require("config.php");

$location_status .= "| Add";
$show_backnav = "menu";
$menuname = NULL;
$menutarget = NULL;

if (NULL!=$action){

	$Date = "$Year-$Month-$Day";

   $field = array(
	"code", 
	"date", 
	"type",
	"subject", 
	"details",
	"picture",
    "target",
	);


   $content = array(
	$Code,
	$Date,
	$Type,
	$Subject,
	$Details,
	$Picture_name,
	$Target,
	);

   myInsert($table,$field,$content);

	$dir = "med_showcase/";

	myUpload($Picture,$Picture_name,$dir);


   header("location:" . $rela_path . "share/msg.php?v=59");

   exit();

}else{

  if (checkCode($table,$Code)){

	header("location:" . $rela_path . "share/msg.php?v=9001");

	exit();
  
  }

}

$Query = "select code, name from med_showcase_type";
$types = myQuery($Query);

require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");

?>



<form action="" method="post" enctype="multipart/form-data" name="form1">
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">




<table width="95%" border="0" align="center">
  <tr> 
    <td valign="top"> <table border="0" cellspacing="5" cellpadding="1">
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td class="tdheader">Code : </td>
            <td><?print($Code)?></td>
          </tr>
          <tr> 
            <td class="tdheader">Date :</td>
            <td><?print(FFPdate(date("Y-m-d")))?></td>
          </tr>
          <tr>
            <td class="tdheader">Type :</td>
            <td><select class="select" name="Type"  <?print($active)?>>
<?
for ($i=0;$i<count($types);$i++){
	print("<option value=\"" . $types[$i][1] . "\">" . $types[$i][1] . "</option>");
}

?>
</select>
              <!--<input type="button" name="Submit" class="button" value="edit type" onclick="Redirect('../showcase_type/menu.php',1)"> --></td>
          </tr>
          <tr> 
            <td class="tdheader">Subject :</td>
            <td><input type="text" class="text" name="Subject" size="56"></td>
          </tr>
          <tr> 
            <td class="tdheader">Details : </td>
            <td><textarea class="text" name="Details" cols="55" rows="20"></textarea></td>
          </tr>
          <tr> 
            <td class="tdheader">Picture :</td>
            <td><input type="file" class="text" name="Picture" size="45"> </td>
          </tr>
          <tr> 
            <td class="tdheader">Target :</td>
            <td><input name="Target" type="text" class="text" id="Target" size="56"></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td> <input type="image" src="../../images/bt_cancel.gif" onClick="Redirect('menu.php',1);return false;"> 
              <input type="image" src="../../images/bt_save.gif"> </td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
    </td>

  </tr>
</table>
<br>
<br>
<br>


</form>

<?
require($rela_path . "inc/footer.php");
?>
